#ifndef _NFMS_H
#define _NFMS_H


typedef struct 
{
	uChar data[PAGE_TOTAL_SIZE]; /*Data + spare*//*PageSize:2048+64 */
	uInt32 empty;      /* is this empty? */
} nandemul_Page;

typedef struct
{
	nandemul_Page* page[PAGES_PER_BLOCK];	/*pages per block:64*/
	uInt32 damaged;	
} nandemul_Block;


typedef struct
{
	nandemul_Block* block[BLOCKS_PER_CHIP];
	uInt32 nBlocks;
} nandemul_Chip;

typedef	struct
{
	nandemul_Chip*	pChip[CHANNEL_COUNT * CHIP_COUNT];
	uInt32	nChips;
}nandemul_Device;


static uInt32 NFMS_Init(void);
static uInt32 NFMS_CleanUp(void);
static uInt32 NFMS_Blank(void);
static uInt32 NFMS_Erase(NandAddr *addr);
static uInt32 NFMS_Read_SectorSpare(NandAddr *add, uInt32 nSectors, void* dataBuffer ,void* spareBuffer);
static uInt32 NFMS_Write_SectorSpare(NandAddr *add, uInt32 nSectors, void* dataBuffer ,void* spareBuffer);
static uInt32 NFMS_Read_Spare(NandAddr *addr, uInt32 nSectors, void* spareBuffer);
static uInt32 NFMS_Write_Spare(NandAddr *addr, uInt32 nSectors, void* spareBuffer);
static uInt32 NFMS_PageCpy(void);
static uInt32 NFMS_ReadID(void);

#endif  /* _NFMS_H */
